<?php

class Photos_process extends CI_Model {//这里关于admin表的一些操作和登录判定

    const Statustrue = True;
    const Statusflase = False;

    function __construct() {
        parent::__construct();
    }

    function front_photo_list($ablum_id) {
        $sql = "select * from photos where album_id= \"{$ablum_id}\" order by  `order` desc limit 9";
        $query = $this->db->query($sql);
        return $res = $query->result_array();
    }

    function photo_list($ablum_id) {
        $sql = "
            select photos.*,album.title as alblum_title from photos ,album where
photos.album_id=album.id and 
 photos.album_id=\"{$ablum_id}\" ";
        $query = $this->db->query($sql);
        return $res = $query->result_array();
    }

    function add_photo($post_array) {
        $insertsql = "insert into photos(title,
album_id,
path,
type,
`order`
)values(\"{$post_array["title"]}\",\"{$post_array["album_id"]}\",\"{$post_array["path"]}\",0,1)";
        $this->db->query($insertsql);
    }

}

?>
